/*
 * Copyright (C) 2021 Realtek Semiconductor Corp.
 * All Rights Reserved.
 *
 * This program is the proprietary software of Realtek Semiconductor
 * Corporation and/or its licensors, and only be used, duplicated,
 * modified or distributed under the authorized license from Realtek.
 *
 * ANY USE OF THE SOFTWARE OTHER THAN AS AUTHORIZED UNDER
 * THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
 *
 * Purpose : Definition of ME handler: Energy consumption performance monitoring history data (343)
 *
 * Feature : The file includes the following modules and sub-modules
 *           (1) ME handler: Energy consumption performance monitoring history data (343)
 */

#include "app_basic.h"
#ifndef OMCI_X86
#include "rtk/stat.h"
#endif

MIB_TABLE_INFO_T gMibEnergyConsumPmHistoryDataTableInfo;
MIB_ATTR_INFO_T  gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ETHPMHISTORYDATA_ATTR_NUM];
MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_T gMibEnergyConsumPmHistoryDataDefRow;
MIB_TABLE_OPER_T gMibEnergyConsumPmHistoryDataOper;

GOS_ERROR_CODE EgyConsumPmHistoryData_CfgMe(void* pOldRow, void* pNewRow, MIB_OPERA_TYPE operationType, MIB_ATTRS_SET attrSet, UINT32 pri)
{
    GOS_ERROR_CODE                  ret=GOS_OK;

    return ret;
}

GOS_ERROR_CODE EgyConsum_pmhd_pm_handler(MIB_TABLE_INDEX         tableIndex,
                                        omci_me_instance_t      instanceID,
                                        omci_pm_oper_type_t     operType,
                                        BOOL                    *pIsTcaRaised)
{
    GOS_ERROR_CODE                  ret=GOS_OK;

    return ret;
}

GOS_ERROR_CODE mibTable_init(MIB_TABLE_INDEX tableId)
{
    gMibEnergyConsumPmHistoryDataTableInfo.Name = "EnergyConsumptionPmHistoryData";
    gMibEnergyConsumPmHistoryDataTableInfo.ShortName = "EgyConsumPmData";
    gMibEnergyConsumPmHistoryDataTableInfo.Desc = "Energy consumption performance monitoring history data";
    gMibEnergyConsumPmHistoryDataTableInfo.ClassId = (UINT32)(OMCI_ME_CLASS_ENERGY_CONSUMPTION_PM_HISTORY_DATA);
    gMibEnergyConsumPmHistoryDataTableInfo.InitType = (UINT32)(OMCI_ME_INIT_TYPE_OLT);
    gMibEnergyConsumPmHistoryDataTableInfo.StdType = (UINT32)(OMCI_ME_TYPE_STANDARD_PM);
    gMibEnergyConsumPmHistoryDataTableInfo.ActionType = (UINT32)(OMCI_ME_ACTION_CREATE | OMCI_ME_ACTION_DELETE | OMCI_ME_ACTION_SET | OMCI_ME_ACTION_GET | OMCI_ME_ACTION_GET_CURRENT_DATA);
    gMibEnergyConsumPmHistoryDataTableInfo.pAttributes = &(gMibEnergyConsumPmHistoryDataAttrInfo[0]);

    gMibEnergyConsumPmHistoryDataTableInfo.attrNum = MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_ATTR_NUM;
    gMibEnergyConsumPmHistoryDataTableInfo.entrySize = sizeof(MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_T);
    gMibEnergyConsumPmHistoryDataTableInfo.pDefaultRow = &gMibEnergyConsumPmHistoryDataDefRow;

    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_ENTITY_ID_INDEX  - MIB_TABLE_FIRST_INDEX].Name = "EntityId";
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_INTERVAL_END_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].Name = "IntEndTime";
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_THRESHOLD_ID_INDEX  - MIB_TABLE_FIRST_INDEX].Name = "ThresholdID";
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_DOZE_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].Name = "FCSErrors";
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_CYCLIC_SLEEP_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].Name = "ExcCollision";
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_WATCHFUL_SLEEP_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].Name = "LateCollision";
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_ENERGY_CONSUMED_INDEX  - MIB_TABLE_FIRST_INDEX].Name = "FrameTooLongs";

    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_ENTITY_ID_INDEX  - MIB_TABLE_FIRST_INDEX].Desc = "Entity ID";
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_INTERVAL_END_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].Desc = "Interval End Time";
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_THRESHOLD_ID_INDEX  - MIB_TABLE_FIRST_INDEX].Desc = "Threshold Data ID";
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_DOZE_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].Desc = "FCS Errors";
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_CYCLIC_SLEEP_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].Desc = "Excessive collision counter";
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_WATCHFUL_SLEEP_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].Desc = "Late collision counter";
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_ENERGY_CONSUMED_INDEX  - MIB_TABLE_FIRST_INDEX].Desc = "FrameTooLongs";

    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_ENTITY_ID_INDEX  - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_INTERVAL_END_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT8;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_THRESHOLD_ID_INDEX  - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_DOZE_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_CYCLIC_SLEEP_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_WATCHFUL_SLEEP_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_ENERGY_CONSUMED_INDEX  - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;

    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_ENTITY_ID_INDEX  - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_INTERVAL_END_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].Len = 1;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_THRESHOLD_ID_INDEX  - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_DOZE_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_CYCLIC_SLEEP_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_WATCHFUL_SLEEP_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_ENERGY_CONSUMED_INDEX  - MIB_TABLE_FIRST_INDEX].Len = 4;

    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_ENTITY_ID_INDEX  - MIB_TABLE_FIRST_INDEX].IsIndex = TRUE;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_INTERVAL_END_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_THRESHOLD_ID_INDEX  - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_DOZE_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_CYCLIC_SLEEP_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_WATCHFUL_SLEEP_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_ENERGY_CONSUMED_INDEX  - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;

    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_ENTITY_ID_INDEX  - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_INTERVAL_END_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_THRESHOLD_ID_INDEX  - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_DOZE_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_CYCLIC_SLEEP_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_WATCHFUL_SLEEP_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_ENERGY_CONSUMED_INDEX  - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;

    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_ENTITY_ID_INDEX  - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_INTERVAL_END_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_THRESHOLD_ID_INDEX  - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_DOZE_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_CYCLIC_SLEEP_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_WATCHFUL_SLEEP_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_ENERGY_CONSUMED_INDEX  - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;

    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_ENTITY_ID_INDEX  - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_SBC;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_INTERVAL_END_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_THRESHOLD_ID_INDEX  - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_DOZE_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_CYCLIC_SLEEP_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_WATCHFUL_SLEEP_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_ENERGY_CONSUMED_INDEX  - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;

    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_ENTITY_ID_INDEX  - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_INTERVAL_END_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_THRESHOLD_ID_INDEX  - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_DOZE_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_CYCLIC_SLEEP_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_WATCHFUL_SLEEP_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_ENERGY_CONSUMED_INDEX  - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;

    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_ENTITY_ID_INDEX  - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_INTERVAL_END_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_THRESHOLD_ID_INDEX  - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_DOZE_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_CYCLIC_SLEEP_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_WATCHFUL_SLEEP_TIME_INDEX  - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibEnergyConsumPmHistoryDataAttrInfo[MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_ENERGY_CONSUMED_INDEX  - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);

    memset(&(gMibEnergyConsumPmHistoryDataDefRow.EntityId), 0x00, sizeof(gMibEnergyConsumPmHistoryDataDefRow.EntityId));
    memset(&(gMibEnergyConsumPmHistoryDataDefRow.IntervalEndTime), 0x00, sizeof(gMibEnergyConsumPmHistoryDataDefRow.IntervalEndTime));
    memset(&(gMibEnergyConsumPmHistoryDataDefRow.ThresholdID), 0x00, sizeof(gMibEnergyConsumPmHistoryDataDefRow.ThresholdID));
    memset(&(gMibEnergyConsumPmHistoryDataDefRow.DozeTime), 0x00, sizeof(gMibEnergyConsumPmHistoryDataDefRow.DozeTime));
    memset(&(gMibEnergyConsumPmHistoryDataDefRow.CyclicSleepTime), 0x00, sizeof(gMibEnergyConsumPmHistoryDataDefRow.CyclicSleepTime));
    memset(&(gMibEnergyConsumPmHistoryDataDefRow.WatchfulSleepTime), 0x00, sizeof(gMibEnergyConsumPmHistoryDataDefRow.WatchfulSleepTime));
    memset(&(gMibEnergyConsumPmHistoryDataDefRow.EnergyConsumed), 0x00, sizeof(gMibEnergyConsumPmHistoryDataDefRow.EnergyConsumed));

    memset(&gMibEnergyConsumPmHistoryDataOper, 0x0, sizeof(MIB_TABLE_OPER_T));
    gMibEnergyConsumPmHistoryDataOper.meOperDrvCfg = EgyConsumPmHistoryData_CfgMe;
    gMibEnergyConsumPmHistoryDataOper.meOperConnCheck = NULL;
    gMibEnergyConsumPmHistoryDataOper.meOperConnCfg = NULL;
    gMibEnergyConsumPmHistoryDataOper.meOperAvlTreeAdd = NULL;
    gMibEnergyConsumPmHistoryDataOper.meOperDump = omci_mib_oper_dump_default_handler;
    gMibEnergyConsumPmHistoryDataOper.meOperPmHandler = EgyConsum_pmhd_pm_handler;

    MIB_TABLE_ENERGY_CONSUMPTION_PM_HISTORY_DATA_INDEX = tableId;
    MIB_InfoRegister(tableId, &gMibEnergyConsumPmHistoryDataTableInfo, &gMibEnergyConsumPmHistoryDataOper);

    return GOS_OK;
}
